package com.cuz.daileetcode.avl;

import java.util.List;

/**
 * @author cuzz
 * @version 1.0
 * @description: avl 树节点类
 * @date 20:12 2022/2/5
 **/
public class AVLTreeNode<T extends Comparable<T>, V> {

    /***
     * 树节点key 将根据此节点的值组织树节点
     */
    private T key;
    /***
     * 当前节点对应的高度
     */
    private int height;

    /***
     * 左右子树 节点
     */
    private AVLTreeNode<T, V> left;

    private AVLTreeNode<T, V> right;
    /***
     * 值list 允许存在多个相同的值
     */
    private List<V> valueList;
    private AVLTreeNode<T, V> parent;

    public AVLTreeNode<T, V> getParent() {
        return parent;
    }

    public void setParent(AVLTreeNode<T, V> parent) {
        this.parent = parent;
    }

    public AVLTreeNode() {
    }

    public AVLTreeNode(T key, int height, AVLTreeNode<T, V> left, AVLTreeNode<T, V> right,
                       List<V> valueList, AVLTreeNode<T, V> parent) {
        this.key = key;
        this.height = height;
        this.left = left;
        this.right = right;
        this.valueList = valueList;
        this.parent = parent;
    }

    public T getKey() {
        return key;
    }

    public void setKey(T key) {
        this.key = key;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public AVLTreeNode<T, V> getLeft() {
        return left;
    }

    public void setLeft(AVLTreeNode<T, V> left) {
        this.left = left;
    }

    public AVLTreeNode<T, V> getRight() {
        return right;
    }

    public void setRight(AVLTreeNode<T, V> right) {
        this.right = right;
    }

    public List<V> getValueList() {
        return valueList;
    }

    public void setValueList(List<V> valueList) {
        this.valueList = valueList;
    }
}
